/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tk.eigh.ksvg.renderer.filter;

import java.io.IOException;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import ksvg.filter.Flood;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
import tk.eigh.ksvg.SVG;
import tk.eigh.ksvg.renderer.SVGFilterRenderer;
import tk.eigh.ksvg.renderer.SVGRendererUtils;

/**
 *
 * @author nt
 */
@JSFRenderer(renderKitId = "SVG", type = "filter.SVGFloodRenderer", family = "filter.Flood")
public class SVGFloodRenderer extends SVGFilterRenderer {

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        super.encodeBegin(context, component);

        ResponseWriter writer = context.getResponseWriter();
        Flood flood = (Flood) component;
        writer.startElement(SVG.FE_FLOOD_TAG_NAME, component);
        renderCommonAttributes(writer, component, context);
        SVGRendererUtils.renderImplementedAttributes(component, writer);
        for (Map.Entry<String, String> attrMap : SVG.FE_FLOOD_ELEMENT_PROPERTIES.entrySet()) {
            HtmlRendererUtils.renderHTMLAttribute(writer, component, attrMap.getKey(), attrMap.getValue());
        }
    }

    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        super.encodeEnd(context, component);
        context.getResponseWriter().endElement(SVG.FE_FLOOD_TAG_NAME);
    }
}
